# import requests  # 导入requests
# import random  # 取随机数
# import time
# from lxml import etree
# url = 'https://www.amazon.com/dp/0062696858'
# proxies = {'http': '125.123.127.251:9000'}
# headers = {
#     'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36',
# }
# session = requests.session()
# response = session.get(url, headers=headers, proxies=proxies, timeout=(3, 7))
# response_soup = etree.HTML(response.content.decode('utf-8'))
# time.sleep(random.uniform(0.5, 0.7))
# htmlstr = response.content.decode('utf-8')
# print(htmlstr)


import requests

headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36',
    'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
    'accept-encoding': 'gzip, deflate, br'
}
proxies_list = ['140.143.48.49:1080', '125.65.79.60:3311', '58.17.125.215:53281', '39.108.71.144:8000',
                '61.178.149.237:59042', '47.106.197.184:8000', '122.152.138.139:80', '112.250.107.37:53281',
                '106.104.12.180:80', '123.206.54.52:8118', '60.211.218.78:53281', '58.211.134.98:38480',
                '218.108.175.15:80', '1.34.146.163:30086', '119.178.101.18:8888', '192.144.191.242:80',
                '124.172.232.49:8010', '119.23.221.40:8118', '221.226.94.218:110', '27.191.234.69:9999',
                '139.199.19.174:8118', '120.79.64.147:8118', '59.172.27.6:38380', '61.160.210.223:808',
                '61.160.210.234:808', '47.95.249.140:8118']
cookie = {'session-id': '133-6601898-5690606', 'ubid-main': '134-2195699-6860430',
          'x-wl-uid': '1sO46Mqh6SKcW+BjRAZ+E++yhRBvTn/pdnYF0xjOL3vEQKiN+PD30aEKDFVDN/cUVNgVbmn1nL80=',
          'session-token': 'inSc2Q4/90BYSrv1likZycKCgrWGuc08mRej5dgnjB/Ma5uau/XezdiGu7MvWlnB2Db8MP4/D9tvusAYUHgVJMm3bD5NWVCvI94dvia2WGOHzW8zyYktrv/mOQg7uqlbHwFRaBSNFHb2sqNDCknsHQHzHD7JKjkUwszMUpAKUYP8tlrGlMq4gzCKWgsISR08FBIZJ4eguFKckt06ruz+V1mUYZGAfc7klUu6WYdn5GbjM8TVWrI4T1HrJsScqWQ8RlFwJiAviK0=',
          'session-id-time': '2082787201l'}
response = requests.get("https://www.amazon.com/gp/offer-listing/B06XCGRSBZ", headers=headers, proxies={'http': proxies_list[15]}, cookies=cookie)


with open('op.html','w',encoding="utf-8") as fp:
  fp.write(response.content.decode('utf-8'))


